package main.java.com.fei.springboot.constants;

/**
 * ClassName: Status
 *
 * @author jzy
 * @Description:错误码枚举类
 * @date 2016-5-13
 */
public enum Status {
    /**********************************************************************************
     * 1开头 系统模块
     **********************************************************************************/
    SUCCESS(0, "成功"),
    SYSTEM_ERROR(10001, "系统异常"),
    MISS_REQUIRED_PARAMETER(10002, "缺失必要的参数"),
    NO_AUTH(10003, "您无权限进行此操作，请确认"),
    AUTHENTICATION_UNSUCCESSFUL(10004, "用户名或密码不正确，发送失败"),
    SESSION_TIME_OUT(10005, "会话已过期，请重新登录");

    /**********************************************************************************
     * 2开头 用户模块
     **********************************************************************************/





    private int code;
    private String msg;

    private Status(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String getMsg(int code) {
        for (Status value : Status.values()) {
            if (value.getCode() == code) {
                return value.msg;
            }
        }
        return "";
    }

    public int getCode() {
        return code;
    }

    private void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    private void setMsg(String msg) {
        this.msg = msg;
    }
}
